const mongoose = require("mongoose");
/* 1.连接本地数据库 */
mongoose.connect( 'mongodb://127.0.0.1:27017/movies', {useNewUrlParser: true});
/* 2.在本地定义一个Schema和远程的数据库的字段映射 */
var UserSchema =new mongoose.Schema({
    name:String,
    collects:[
        {_id:String,name:String,rating:String,like:Boolean}
    ]
},{
    versionKey: false // You should be aware of the outcome after set to false
}
);
/* 3.创建数据类型，操作数据库 */
/* Top250Model 是我们获取的top250那张表 */
var UserModel = mongoose.model('User',UserSchema,"user")//小写的top250对应表名称
module.exports = UserModel;